<%-- 
    Document   : consulta_evento
    Created on : 28/04/2014, 20:10:27
    Author     : Juliane Chaerki
--%>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="java.util.List"%>
<%@page import="model.beans.Evento"%>
<%@page import="model.dao.EventoDAO"%>
<!DOCTYPE html>
    <%@include file='head.jsp'%>
    <body>
        <div id="templatemo_body_wrapper">
            <div id="templatemo_wrapper">
                <c:if test="${sessionScope.tipo == 0}">
                    <%@include file='header.jsp'%>
                </c:if>
                <c:if test="${sessionScope.tipo == 1}">
                    <%@include file='header_admin.jsp'%>    
                </c:if> 
                <div id="templatemo_middle">
                    <div id="mid_title">Consulta de Eventos</div>
                </div>
                <div id="templatemo_main">
                    <form method="post" action="Controladora?action=ConsultaEvento">
                        <div class="columns20_80">
                            <div class="_20"></div>
                                <div class="_80">
                                    <input name="busca" maxlength="256" type="text" class="input_field" style="width:350px;" id="busca"/>
                                    <input type="submit" class="botao_login" style="margin-right: 280px;" name="submit" id="salvar" value="Buscar" />
                                </div>
                        </div>
                    </form>

                    <table class="tabela">
                        <thead>
                            <tr>
                                <th>Nome Evento</th>
                                <th>Data</th>
                                <th>Tipo</th>
                                <th>Editar</th>
                                <th>Excluir</th>
                            </tr>
                        </thead>
                        <tbody>
                            <c:if test="${listaEventos != null}">
                                <c:forEach var="evento" items="${listaEventos}">
                                    <tr>
                                        <td><c:out value="${evento.nome}" /></td>
                                        <td><fmt:formatDate value="${evento.data}" pattern="dd/MM/yyyy" /> </td>
                                        <td><c:out value="${evento.nometipo}" /></td>
                                        <td> 
                                            <form method="POST" action="Controladora?action=AlteraEvento">
                                                <input type="hidden" name="idEdita" value="${evento.id}" />
                                                <input type="image" src="images/ico_edit.png" class="edit"/>
                                            </form>
<!--                                            <a href='#'><img class='edit' src='images/ico_edit.png'/> </a> -->
                                        </td>
                                        <td> 
                                            <form method="POST" action="Controladora?action=DeletarEvento">
                                                <input type="hidden" name="idDel" value="${evento.id}" />
                                                <input type="image" src="images/ico_del.png" class="edit"/>
                                            </form>
<!--                                            <a href='#'><img class='edit' src='images/ico_del.png'/> </a> -->
                                        </td>
                                    </tr>
                                </c:forEach>
                            </c:if>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <c:if test="${ msg != null }">
            <script type="text/javascript">
                var msg = '${msg}';
                alert(msg);
            </script>
        </c:if>
</body>
<%@include file='footer.jsp'%>
